home *** CD-ROM | disk | FTP | other *** search
- class §#26§
- {
- static var §#95§ = false;
- var currentMusic = 0;
- var §#77§ = 50;
- var musicVolume = 50;
- var §#32§ = false;
- var §#39§ = false;
- function §#26§(§#385§)
- {
- eval("#26").instance = this;
- _root.createEmptyMovieClip("sfxMC",_root.getNextHighestDepth());
- _root.createEmptyMovieClip("musicMC",_root.getNextHighestDepth());
- if(eval("#26")["#95"])
- {
- eval("#0").log(this["#2"]() + "created " + this.toString());
- }
- if(§#385§ != undefined)
- {
- this["#339"](§#385§);
- }
- }
- static function getInstance()
- {
- if(eval("#26").instance == null)
- {
- eval("#26").instance = new §#26§();
- }
- return eval("#26").instance;
- }
- function §#2§()
- {
- return "SoundManager: ";
- }
- function toString(§#405§)
- {
- var _loc2_ = "[SoundManager ";
- _loc2_ += "sfx: " + this["#77"];
- if(this["#32"])
- {
- _loc2_ += "(muted) ";
- }
- _loc2_ += ", music: " + this.musicVolume;
- if(this["#39"])
- {
- _loc2_ += "(muted) ";
- }
- _loc2_ += ", sounds: " + this["#12"].length;
- if(§#405§)
- {
- _loc2_ += "\nMusic:";
- _loc2_ += "\n " + this["#15"].join("\n ") + "\n";
- _loc2_ += "\nSound:";
- _loc2_ += "\n " + this["#12"].join("\n ") + "\n";
- }
- _loc2_ += "]";
- return _loc2_;
- }
- function §#339§(names, §#288§, append)
- {
- if(names == undefined || names.length < 1)
- {
- return undefined;
- }
- if(§#288§ == undefined)
- {
- §#288§ = "#385";
- }
- var _loc6_ = new Array(names.length);
- var _loc3_ = 0;
- while(_loc3_ < names.length)
- {
- _loc6_[_loc3_] = new §#27§(_root.sfxMC);
- var _loc4_ = !this["#32"] ? this["#77"] : 0;
- _loc6_[_loc3_].loadSound(§#288§,names[_loc3_],_loc4_);
- _loc3_ = _loc3_ + 1;
- }
- if(append)
- {
- this["#12"] = this["#12"].concat(_loc6_);
- this["#38"] = this["#38"].concat(names);
- }
- else
- {
- this["#12"] = _loc6_;
- this["#38"] = names;
- }
- }
- function §#316§(names, append)
- {
- if(names == undefined || names.length < 1)
- {
- return undefined;
- }
- var _loc6_ = new Array(names.length);
- var _loc3_ = 0;
- while(_loc3_ < names.length)
- {
- _loc6_[_loc3_] = new §#27§(_root.sfxMC);
- var _loc4_ = !this["#32"] ? this["#77"] : 0;
- _loc6_[_loc3_].attachSound(names[_loc3_],_loc4_);
- _loc3_ = _loc3_ + 1;
- }
- if(append && this["#12"] != undefined)
- {
- this["#12"] = this["#12"].concat(_loc6_);
- this["#38"] = this["#38"].concat(names);
- }
- else
- {
- this["#12"] = _loc6_;
- this["#38"] = names;
- }
- if(eval("#26")["#95"])
- {
- eval("#0").log(this["#2"]() + "attached sounds: " + this.toString(true));
- }
- }
- function §#427§(names, §#288§, append)
- {
- if(names == undefined || names.length < 1)
- {
- return undefined;
- }
- if(§#288§ == undefined)
- {
- §#288§ = "music";
- }
- var _loc6_ = new Array(names.length);
- var _loc3_ = 0;
- while(_loc3_ < names.length)
- {
- _loc6_[_loc3_] = new §#27§(_root.musicMC);
- var _loc4_ = !this["#39"] ? this.musicVolume : 0;
- _loc6_[_loc3_].loadSound(§#288§,names[_loc3_],_loc4_);
- _loc3_ = _loc3_ + 1;
- }
- if(append)
- {
- this["#15"] = this["#15"].concat(_loc6_);
- this["#66"] = this["#66"].concat(names);
- }
- else
- {
- this["#15"] = _loc6_;
- this["#66"] = names;
- }
- }
- function §#322§(names, append)
- {
- if(names == undefined || names.length < 1)
- {
- return undefined;
- }
- var _loc6_ = new Array(names.length);
- var _loc3_ = 0;
- while(_loc3_ < names.length)
- {
- _loc6_[_loc3_] = new §#27§(_root.musicMC);
- var _loc4_ = !this["#39"] ? this.musicVolume : 0;
- _loc6_[_loc3_].attachSound(names[_loc3_],_loc4_);
- _loc3_ = _loc3_ + 1;
- }
- if(append && this["#12"] != undefined)
- {
- this["#15"] = this["#15"].concat(_loc6_);
- this["#66"] = this["#66"].concat(names);
- }
- else
- {
- this["#15"] = _loc6_;
- this["#66"] = names;
- }
- }
- function setSoundVolume(§#106§)
- {
- §#106§ = Math.round(§#106§);
- if(§#106§ < 0)
- {
- §#106§ = 0;
- }
- else if(§#106§ > 100)
- {
- §#106§ = 100;
- }
- this["#77"] = §#106§;
- if(!this["#32"])
- {
- var _loc2_ = 0;
- while(_loc2_ < this["#12"].length)
- {
- this["#12"][_loc2_].setVolume(§#106§);
- _loc2_ = _loc2_ + 1;
- }
- }
- }
- function getSoundVolume()
- {
- if(this["#32"])
- {
- return 0;
- }
- return this["#77"];
- }
- function setMusicVolume(§#106§)
- {
- §#106§ = Math.round(§#106§);
- if(§#106§ < 0)
- {
- §#106§ = 0;
- }
- else if(§#106§ > 100)
- {
- §#106§ = 100;
- }
- this.musicVolume = §#106§;
- if(!this["#39"])
- {
- this["#15"][this.currentMusic].setVolume(§#106§);
- }
- }
- function getMusicVolume()
- {
- if(this["#39"])
- {
- return 0;
- }
- return this.musicVolume;
- }
- function §#353§(§#46§)
- {
- this["#32"] = true;
- var _loc2_ = 0;
- while(_loc2_ < this["#12"].length)
- {
- if(this["#12"][_loc2_]["#34"] && this["#12"][_loc2_].getVolume() > 0)
- {
- this["#12"][_loc2_]["#64"](0,§#46§);
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function §#352§(§#46§)
- {
- this["#39"] = true;
- var _loc2_ = 0;
- while(_loc2_ < this["#15"].length)
- {
- if(this["#15"][_loc2_]["#34"] && this["#15"][_loc2_].getVolume() > 0)
- {
- this["#15"][_loc2_]["#64"](0,§#46§);
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function §#332§(§#46§)
- {
- this["#32"] = false;
- var _loc2_ = 0;
- while(_loc2_ < this["#12"].length)
- {
- if(this["#12"][_loc2_]["#34"])
- {
- this["#12"][_loc2_]["#64"](this["#77"],§#46§);
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function §#331§(§#46§)
- {
- this["#39"] = false;
- var _loc2_ = 0;
- while(_loc2_ < this["#15"].length)
- {
- if(this["#15"][_loc2_]["#34"])
- {
- this["#15"][_loc2_]["#64"](this.musicVolume,§#46§);
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function §#187§(§#375§, §#120§, §#46§)
- {
- if(this["#32"])
- {
- return undefined;
- }
- if(this["#12"][§#375§] == undefined)
- {
- eval("#0").log(this["#2"]() + "undefined sound " + §#375§ + ": " + this["#38"][§#375§]);
- }
- else
- {
- if(eval("#26")["#95"])
- {
- eval("#0").log(this["#2"]() + "playing sound " + §#375§ + ": " + this["#38"][§#375§] + ", volume " + this.getSoundVolume() + ", " + §#120§ + " loops");
- }
- if(§#120§ == undefined || §#120§ < 1)
- {
- §#120§ = 1;
- }
- if(§#46§ == undefined || §#46§ <= 0 || this["#32"])
- {
- this["#12"][§#375§].setVolume(this.getSoundVolume());
- this["#12"][§#375§].start(0,§#120§);
- }
- else
- {
- this["#12"][§#375§].setVolume(0);
- this["#12"][§#375§].start(0,§#120§);
- this["#12"][§#375§]["#64"](this.getSoundVolume(),§#46§);
- }
- }
- }
- function §#399§(§#189§, §#120§, §#46§)
- {
- if(this["#32"])
- {
- return undefined;
- }
- this["#187"](this.getSoundIDForName(§#189§),§#120§,§#46§);
- }
- function §#263§(§#375§, §#46§)
- {
- if(this["#12"][§#375§] == undefined)
- {
- eval("#0").log(this["#2"]() + "undefined sound " + §#375§ + ": " + this["#38"][§#375§]);
- }
- else
- {
- if(!this["#12"][§#375§]["#34"])
- {
- return undefined;
- }
- if(eval("#26")["#95"])
- {
- eval("#0").log(this["#2"]() + "stopping sound " + §#375§ + ": " + this["#38"][§#375§] + ", volume " + this["#12"][§#375§].getVolume() + " (" + this["#12"][0].getVolume() + ")");
- }
- if(§#46§ == undefined || §#46§ <= 0)
- {
- this["#12"][§#375§].stop();
- }
- else
- {
- this["#12"][§#375§]["#64"](0,§#46§);
- }
- }
- }
- function §#400§(§#189§, §#46§)
- {
- this["#263"](this.getSoundIDForName(§#189§),§#46§);
- }
- function stopAllSounds(§#46§)
- {
- var _loc2_ = 0;
- while(_loc2_ < this["#38"].length)
- {
- this["#263"](_loc2_,§#46§);
- _loc2_ = _loc2_ + 1;
- }
- }
- function getSoundIDForName(§#189§)
- {
- var _loc2_ = 0;
- while(_loc2_ < this["#38"].length)
- {
- if(this["#38"][_loc2_] == §#189§)
- {
- return _loc2_;
- }
- _loc2_ = _loc2_ + 1;
- }
- if(eval("#26")["#95"])
- {
- eval("#0").log(this["#2"]() + "getSoundIDForName couldn\'t find sound " + §#189§);
- }
- return undefined;
- }
- function getSoundForName(§#189§)
- {
- return this["#12"][this.getSoundIDForName(§#189§)];
- }
- function §#354§(§#46§)
- {
- if(this["#15"][this.currentMusic] == undefined)
- {
- eval("#0").log(this["#2"]() + "SoundManager: current music is undefined");
- return undefined;
- }
- if(eval("#26")["#95"])
- {
- eval("#0").log(this["#2"]() + "playing music #" + this.currentMusic + " at volume " + this.getMusicVolume());
- }
- if(§#46§ == undefined || §#46§ <= 0 || this["#39"])
- {
- this["#15"][this.currentMusic].setVolume(this.getMusicVolume());
- this["#15"][this.currentMusic].start(0,9999);
- }
- else
- {
- this["#15"][this.currentMusic].setVolume(0);
- this["#15"][this.currentMusic].start(0,9999);
- this["#15"][this.currentMusic]["#64"](this.musicVolume,§#46§);
- }
- }
- function §#261§(§#46§)
- {
- if(§#46§ == undefined || §#46§ <= 0)
- {
- this["#15"][this.currentMusic].stop();
- }
- else
- {
- this["#15"][this.currentMusic]["#64"](0,§#46§,true);
- }
- }
- function setMusicByName(§#260§)
- {
- this.setMusic(this.getMusicIDForName(§#260§));
- }
- function setMusic(§#374§)
- {
- this.currentMusic = §#374§;
- }
- function §#329§(§#374§, §#46§)
- {
- this["#261"](§#374§,§#46§);
- this.setMusic(§#374§);
- this["#354"](§#46§);
- }
- function getCurrentMusic()
- {
- return this["#15"][this.currentMusic];
- }
- function getMusicIDForName(§#260§)
- {
- var _loc2_ = 0;
- while(_loc2_ < this["#66"].length)
- {
- if(this["#66"][_loc2_] == §#260§)
- {
- return _loc2_;
- }
- _loc2_ = _loc2_ + 1;
- }
- eval("#0").log(this["#2"]() + "SoundManager: getMusicIDForName couldn\'t find music " + §#260§);
- return undefined;
- }
- function getMusicForName(§#260§)
- {
- return this["#15"][this.getMusicIDForName(§#260§)];
- }
- }
-